//
//  MooNumber.h
//  BattleEngine
//
//  Created by machine on 12-11-1.
//  Copyright (c) 2012年 machine. All rights reserved.
//

#ifndef __BattleEngine__MooNumber__
#define __BattleEngine__MooNumber__

#include "MooCpp.h"
#include <stdlib.h>

class MooNumber {
public:
    typedef double size_type;
    
public:
    MooNumber();
    MooNumber(int);
    MooNumber(long);
    MooNumber(double);
    MooNumber(const char *);
    MooNumber(const string);
    
    int toInt() const;
    long toLong() const;
    double toDouble() const;
    string toString() const;
    
    // 生成随机函数
    MooNumber static rand(MooNumber from, MooNumber to);
    
    // 取绝对值
    MooNumber abs();
    
    // 向上取整
    MooNumber ceil();
    
    // 向下取整
    MooNumber floor();
    
    // 幂函数
    MooNumber pow(const int &);
    
    // 四舍五入
    MooNumber round(int);
    
    MooNumber operator+(const MooNumber &);
    MooNumber operator+(const int &);
    MooNumber operator+(const long &);
    MooNumber operator+(const double &);
    
    MooNumber operator-(const MooNumber &);
    MooNumber operator-(const int &);
    MooNumber operator-(const long &);
    MooNumber operator-(const double &);
    
    MooNumber operator*(const MooNumber &);
    MooNumber operator*(const int &);
    MooNumber operator*(const long &);
    MooNumber operator*(const double &);
    
    MooNumber operator/(const MooNumber &);
    MooNumber operator/(const int &);
    MooNumber operator/(const long &);
    MooNumber operator/(const double &);
    
    MooNumber operator%(const MooNumber &);
    MooNumber operator%(const int &);
    MooNumber operator%(const long &);
    
    MooNumber operator+=(const MooNumber &);
    MooNumber operator+=(const int &);
    MooNumber operator+=(const long &);
    MooNumber operator+=(const double &);
    
    MooNumber operator-=(const MooNumber &);
    MooNumber operator-=(const int &);
    MooNumber operator-=(const long &);
    MooNumber operator-=(const double &);
    
    MooNumber operator*=(const MooNumber &);
    MooNumber operator*=(const int &);
    MooNumber operator*=(const long &);
    MooNumber operator*=(const double &);
    
    MooNumber operator/=(const MooNumber &);
    MooNumber operator/=(const int &);
    MooNumber operator/=(const long &);
    MooNumber operator/=(const double &);
    
    bool operator>(const MooNumber &);
    bool operator>(const int &);
    bool operator>(const long &);
    bool operator>(const double &);
    
    bool operator>=(const MooNumber &);
    bool operator>=(const long &);
    bool operator>=(const int &);
    bool operator>=(const double &);
    
    bool operator<(const MooNumber &);
    bool operator<(const int &);
    bool operator<(const long &);
    bool operator<(const double &);
    
    bool operator<=(const MooNumber &);
    bool operator<=(const int &);
    bool operator<=(const long &);
    bool operator<=(const double &);
    
    bool operator==(const MooNumber &);
    bool operator==(const int &);
    bool operator==(const long &);
    bool operator==(const double &);
    
    MooNumber & operator++();
    MooNumber & operator--();

private:
    static unsigned short mooRandomSeed;
    size_type _number;
};

MooNumber operator+(int, MooNumber);
MooNumber operator+(long, MooNumber);
MooNumber operator+(double, MooNumber);

MooNumber operator-(int, MooNumber);
MooNumber operator-(long, MooNumber);
MooNumber operator-(double, MooNumber);

MooNumber operator*(int, MooNumber);
MooNumber operator*(long, MooNumber);
MooNumber operator*(double, MooNumber);

MooNumber operator/(int, MooNumber);
MooNumber operator/(long, MooNumber);
MooNumber operator/(double, MooNumber);

MooNumber operator%(int, MooNumber);
MooNumber operator%(long, MooNumber);

bool operator<(int, MooNumber);
bool operator<(long, MooNumber);
bool operator<(double, MooNumber);

bool operator>(int, MooNumber);
bool operator>(long, MooNumber);
bool operator>(double, MooNumber);

bool operator>=(int, MooNumber);
bool operator>=(long, MooNumber);
bool operator>=(double, MooNumber);

bool operator<=(int, MooNumber);
bool operator<=(long, MooNumber);
bool operator<=(double, MooNumber);

bool operator==(int, MooNumber);
bool operator==(long, MooNumber);
bool operator==(double, MooNumber);


#endif /* defined(__BattleEngine__MooNumber__) */
